<script setup>
import {ref, watch} from "vue";
import Demo31 from "@/components/Demo31.vue";


const message=ref("等待消息")

//获取子组件的数据
const getMsg=(msg)=>{
  message.value=msg;
}


//监听数据变化
watch(message,(newv,oldv)=>{
  console.log("数据变化",oldv,newv);
})
</script>

<template>
  demo3 子传父
  {{message}}
<demo31 @getmessage="getMsg"></demo31>

</template>

<style scoped>

</style>